// common/http.api.js

import * as user from './modules/user.js';
import * as good from './modules/good.js';
import * as order from './modules/order.js';
import * as point from './modules/point.js';
import * as agent from './modules/agent.js';
import * as fenxiao from './modules/fenxiao.js';
import * as coupon from './modules/coupon.js';
const http = uni.$u.http;

// api 接口管理
const install = (Vue, vm) => {

	let api = {
		// modules import
		user,
		good,
		order,
		point,
		agent,
		fenxiao,
		coupon,
	};

	let keys = Object.keys(api);
	keys.forEach(k => {
		if (typeof api[k] == 'object') {
			Vue.prototype['$h' + k] = api[k];
		}
	})

	Vue.prototype.$api = api;
}

export default {
	install
}